home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Clock / Include / ClockPar.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.9 KB  |  164 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ClockPar.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Lonnie Millett
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef CLOCKPAR_H
  13. #define CLOCKPAR_H
  14.  
  15. // ----- Framework Layer -----
  16.  
  17. #ifndef FWPART_H
  18. #include "FWPart.h"
  19. #endif
  20.  
  21. // ----- OS Layer -----
  22.  
  23. #ifndef FWMNUITM_H
  24. #include "FWMnuItm.h"
  25. #endif
  26.  
  27. #ifndef FWTIME_H
  28. #include "FWTime.h"
  29. #endif
  30.  
  31. //========================================================================================
  32. // Classes defined in this interface
  33. //========================================================================================
  34.  
  35. class FW_CLASS_ATTR CClockPart;
  36.  
  37. //========================================================================================
  38. // Classes used by this interface
  39. //========================================================================================
  40.  
  41. #if FW_LIB_EXPORT_PRAGMAS
  42. #pragma import on
  43. #endif
  44. class FW_CLASS_ATTR ODStorageUnit;
  45. class FW_CLASS_ATTR ODSession;
  46. class FW_CLASS_ATTR ODFrame;
  47. class FW_CLASS_ATTR ODFocusSet;
  48. class FW_CLASS_ATTR FW_CPart;
  49. class FW_CLASS_ATTR FW_CNullEvent;
  50. class FW_CLASS_ATTR FW_CMenuEvent;
  51. #if FW_LIB_EXPORT_PRAGMAS
  52. #pragma import off
  53. #endif
  54.  
  55. //========================================================================================
  56. // Constants
  57. //========================================================================================
  58.  
  59. const ODCommandID cClockType = FW_kFirstUserCommandID;
  60. const ODCommandID cClockSoundsTick = cClockType + 1;
  61. const ODCommandID cClockSoundsChime = cClockSoundsTick + 1;
  62.  
  63. const short kAnalogClock = 1;
  64. const short kDigitalClock = 2;
  65.  
  66. //========================================================================================
  67. // CClockPart
  68. //========================================================================================
  69.  
  70. class FW_CLASS_ATTR CClockPart : public FW_CPart
  71. {
  72. public:
  73.     static const ODValueType kPartKind;
  74.     static const ODValueType kPartUserName;
  75.  
  76. //----------------------------------------------------------------------------------------
  77. //    Initialization/Destruction
  78. //
  79. public:
  80.     CClockPart(ODPart* odPart);
  81.     virtual ~ CClockPart();
  82.  
  83. //----------------------------------------------------------------------------------------
  84. //    Inherited API
  85. //
  86. public:
  87.     virtual void Initialize(Environment* ev);
  88.         
  89.     virtual FW_CFrame* NewFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, FW_Boolean fromStorage);
  90.     
  91.     virtual FW_Boolean DoIdle(Environment* ev, const FW_CNullEvent& theNullEvent);
  92.     virtual FW_Boolean DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent);
  93.     virtual FW_Boolean DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  94.     
  95.     virtual void InternalizeContent(Environment* ev, ODStorageUnit* storageUnit, FW_CCloneInfo* cloneInfo);
  96.     virtual void ExternalizeContent(Environment* ev, ODStorageUnit* storageUnit, FW_CCloneInfo* cloneInfo);
  97.     
  98. //----------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:
  102.     FW_CTime     GetLastTime() const;
  103.     void         SetLastTime(const FW_CTime& lastTime);
  104.     
  105.     short         GetClockType() const;
  106.     void         SetClockType(short clockType);
  107.     
  108.     void         PlayTickSound();
  109.     void         PlayChimeSound();
  110.     
  111. //----------------------------------------------------------------------------------------
  112. //    Data Members
  113. //
  114. private:
  115.     FW_CTime             fLastTime;
  116.     short                 fClockType;
  117.     
  118.     FW_CPresentation*    fPresentation;
  119.     
  120.     FW_Boolean            fHasTickSound;
  121.     FW_Boolean            fHasChimeSound;
  122.     
  123.     FW_Boolean            fLockIdle;            // Use to block idle while changing clock type
  124.     
  125. #ifdef FW_BUILD_MAC
  126.     FW_PlatformHandle fChimeSound;
  127.     FW_PlatformHandle fTickSound;
  128. #endif
  129. };
  130.  
  131. //----------------------------------------------------------------------------------------
  132. // CClockPart::GetLastTime
  133. //----------------------------------------------------------------------------------------
  134. inline FW_CTime CClockPart::GetLastTime() const
  135. {
  136.     return fLastTime;
  137. }
  138.  
  139. //----------------------------------------------------------------------------------------
  140. // CClockPart::SetLastTime
  141. //----------------------------------------------------------------------------------------
  142. inline void CClockPart::SetLastTime(const FW_CTime& lastTime)
  143. {
  144.     fLastTime = lastTime;
  145. }
  146.  
  147. //----------------------------------------------------------------------------------------
  148. // CClockPart::GetClockType
  149. //----------------------------------------------------------------------------------------
  150. inline short CClockPart::GetClockType() const
  151. {
  152.     return fClockType;
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. // CClockPart::SetClockType
  157. //----------------------------------------------------------------------------------------
  158. inline void CClockPart::SetClockType(short clockType)
  159. {
  160.     fClockType = clockType;
  161. }
  162.  
  163. #endif
  164.